﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DevExpress.Web.ASPxEditors;
using System.Data;

namespace EnterpriseFund.Common
{
    public class ComBoxGetData
    {
        public ComBoxGetData()
        { }

        public static object GetPersonsRange(ListEditItemsRequestedByFilterConditionEventArgs args)
        {
            if (args.Filter != null && args.Filter != "")
            {
                int i = (args.EndIndex / Common.GlobalConstant.CONSTRING_PAGESIZE) + 1;
                string strwhere ="(nsrmc like '%" + args.Filter + "%' or NSRBM Like '%" + args.Filter + "%')";
                ComBoxGetData c = new ComBoxGetData();
                List<Model.DJ_NSRXX> model=c.GetDJ_NSRXXListList(strwhere,i);
                return model;
            }
            else
            {
                int i = (args.EndIndex / Common.GlobalConstant.CONSTRING_PAGESIZE) + 1;
                string strwhere = "";
                ComBoxGetData c = new ComBoxGetData();
                List<Model.DJ_NSRXX> model = c.GetDJ_NSRXXListList(strwhere, i);
                return model;
            }
        }

        public static object GetPersonsRange2(ListEditItemsRequestedByFilterConditionEventArgs args)
        {
            if (args.Filter != null && args.Filter != "")
            {
                int i = (args.EndIndex / Common.GlobalConstant.CONSTRING_PAGESIZE) + 1;
                string strwhere = "(nsrmc like '%" + args.Filter + "%' or NSRBM Like '%" + args.Filter + "%' or NSRSBH Like '%" + args.Filter + "%')";
                ComBoxGetData c = new ComBoxGetData();
                List<Model.DJ_NSRXX> model = c.GetDJ_NSRXXListList(strwhere, i);
                return model;
            }
            else
            {
                int i = (args.EndIndex / Common.GlobalConstant.CONSTRING_PAGESIZE) + 1;
                string strwhere = "";
                ComBoxGetData c = new ComBoxGetData();
                List<Model.DJ_NSRXX> model = c.GetDJ_NSRXXListList(strwhere, i);
                return model;
            }
        }

        /// <summary>
        /// 获取定义的工作时间数据
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        /// <param name="pageIndex">第几页</param>
        /// <returns>查询出来的数据</returns>
        private List<Model.DJ_NSRXX> GetDJ_NSRXXListList(string strWhere, int pageIndex)
        {
            BLL.Common commonBll = new BLL.Common();
            BLL.DJ_NSRXX DJ_NSRXXBLL = new BLL.DJ_NSRXX();
            string fiedls = "NSRDZDAH";
            int total;
            DataSet ds = commonBll.GetListByPage("fund.V_DJ_NSRXX", fiedls, Common.GlobalConstant.CONSTRING_PAGESIZE, pageIndex, strWhere, "NSRDZDAH", out total);
            List<Model.DJ_NSRXX> DJ_NSRXXList = DJ_NSRXXBLL.DataTableToList(ds.Tables[0]);
            List<Model.DJ_NSRXX> DJ_NSRXXAllList = new List<Model.DJ_NSRXX>();
            //total = DJ_NSRXXBLL.GetRecordCount(strWhere, OperateSession.get(GlobalConstant.PARAM_SYSYEAR));
            //int pageRowSize = Common.GlobalConstant.CONSTRING_PAGESIZE;
            return DJ_NSRXXList;
        }




        public static object GetPersonByID(ListEditItemRequestedByValueEventArgs args)
        {
            if (args.Value != null)
            {
                return args.Value;
            }
            return null;
        }
    }
}